const util = require('../../../utils/checkidcard.js');
var api = require('../../../config/api.js');//接口api地址
const app = getApp();

Page({
  data: {
    name: "李四",
    patientslist: [
      {
        name: "李四",
        sex: "男",
        date: "2020-09-16 9:30",
        itemno: 3234224242425656,
        phone: 111398763524,
        symptoms: "发烧",
      },
      {
        name: "李四",
        sex: "男",
        date: "2020-09-15 9:30",
        itemno: 3234224242425656,
        phone: 111398763524,
        symptoms: "发烧",
      },
      {
        name: "李四",
        sex: "男",
        date: "2020-09-14 9:30",
        itemno: 3234224242425656,
        phone: 111398763524,
        symptoms: "发烧",
      },
      {
        name: "李四",
        sex: "男",
        date: "2020-09-13 9:30",
        itemno: 3234224242425656,
        phone: 111398763524,
        symptoms: "发烧",
      },
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that=this;
    var id = wx.getStorageSync("usermsg").id
    console.log("id"+id)
    wx.showLoading({
      title: '查询中...',
    })
    wx.request({
      url: api.Findpatientslist,
      data:{
        creatorid: id
      },
      method: 'POST',
      header: {
        'Content-Type': 'application/json'
      },
      success: function (res) {
        wx.hideLoading()
        console.log(res);
        if (res.data.code == 0) {
          wx.showToast({
            title: '查询成功!',
            icon: 'success',
            duration: 2000,
            success:function(){
             that.setData({
               patientslist:res.data.data
             })
            }
          }, 10)
          
        } else {
          wx.showModal({
            title: '查询失败！',
            content: res.data.msg,
            showCancel: false
          });
        }
      }
    })

  },

  newpatients:function(){
    wx.navigateTo({
      url: '../newpatientsmsg/newpatientsmsg',
    })
  }
})